/* ==========================================================
   TED SUN WIDGET — FIX + BEAUTY v2.6
   scoped: only .ted-sun-widget
   ========================================================== */

.ted-sun-widget, .ted-sun-widget * { box-sizing: border-box; }
.ted-sun-widget{
  font-family: system-ui,-apple-system,Segoe UI,Roboto,Arial;
  --card-radius: 24px;
  --card-border: rgba(15,23,42,.10);
  --text: rgba(15,23,42,.92);
  --muted: rgba(15,23,42,.58);
  --shadow: 0 22px 55px rgba(15,23,42,.12);
  --shadow-soft: 0 14px 34px rgba(15,23,42,.10);
  --inset: inset 0 1px 0 rgba(255,255,255,.65);

  --ring: rgba(37,99,235,.92);
  --ring-bg: rgba(15,23,42,.08);

  --gap: 14px;
  --ray-h: 62px;
  --ray-radius: 18px;
  --ray-cap-w: 44px;     /* ширина “капли” слева */
  --ray-cap-over: 16px;  /* капля заходит под луч */
  --pad: 18px;
}

/* Card */
.ted-sun-widget .tsw-card{
  width: 100%;
  max-width: 980px;
  border-radius: var(--card-radius);
  border: 1px solid var(--card-border);
  background:
    radial-gradient(1200px 520px at 20% 10%, rgba(124,58,237,.10), rgba(255,255,255,0) 60%),
    radial-gradient(1000px 520px at 85% 35%, rgba(6,182,212,.12), rgba(255,255,255,0) 55%),
    radial-gradient(900px 500px at 45% 110%, rgba(245,158,11,.10), rgba(255,255,255,0) 60%),
    linear-gradient(180deg, rgba(255,255,255,.92), rgba(248,250,252,.88));
  box-shadow: var(--shadow);
  padding: var(--pad);
  overflow: hidden;
}

/* Layout */
.ted-sun-widget .tsw-grid{
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 18px;
  align-items: center;
  min-width: 0;
}

/* Orb */
.ted-sun-widget .tsw-orb{
  width: 200px; height: 200px;
  border-radius: 999px;
  position: relative;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 30% 25%, rgba(255,255,255,.98), rgba(255,255,255,.72) 45%, rgba(255,255,255,.28) 75%),
    radial-gradient(circle at 75% 85%, rgba(99,102,241,.14), rgba(34,211,238,.12), rgba(245,158,11,.11), transparent 70%);
  border: 1px solid rgba(15,23,42,.10);
  box-shadow: var(--inset), var(--shadow-soft);
}

.ted-sun-widget .tsw-ring{ position:absolute; inset:0; transform: rotate(-90deg); }
.ted-sun-widget .tsw-ring circle{ transition: stroke-dashoffset 780ms cubic-bezier(.2,.9,.2,1); }

.ted-sun-widget .tsw-center{
  text-align:center;
  color: var(--text);
  padding: 0 10px;
}
.ted-sun-widget .tsw-num{
  font-size: 60px;
  line-height: 1;
  font-weight: 950;
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
}
.ted-sun-widget .tsw-small{
  margin-top: 6px;
  font-size: 16px;
  font-weight: 900;
  color: rgba(15,23,42,.62);
}
.ted-sun-widget .tsw-sub{
  margin-top: 4px;
  font-size: 12px;
  font-weight: 850;
  color: rgba(15,23,42,.55);
}

/* Rays wrapper */
.ted-sun-widget .tsw-rays{
  display:flex;
  flex-direction:column;
  gap: var(--gap);
  min-width:0;
  position: relative;
  padding-left: 10px; /* чуть воздуха от шара */
}

/* Ray base */
.ted-sun-widget .tsw-ray{
  --ray-bg: linear-gradient(90deg, #7C3AED, #EC4899); /* fallback */
  height: var(--ray-h);
  border-radius: var(--ray-radius);
  background: var(--ray-bg);
  padding: 12px 16px;
  position: relative;
  overflow: visible;           /* чтобы капля не резалась */
  z-index: 1;
  box-shadow: var(--shadow-soft);
  transition: transform 220ms ease, box-shadow 220ms ease, filter 220ms ease;

  display: grid;
  grid-template-columns: minmax(0, 1fr) auto; /* важно: чтобы “пройдено уроков” помещалось */
  align-items: center;
  gap: 14px;
  min-width: 0;
  max-width: 100%;
}

/* капля слева: теперь не “кирпич”, а мягкая форма под лучом */
.ted-sun-widget .tsw-ray::before{
  content:"";
  position:absolute;
  left: calc(-1 * var(--ray-cap-w));
  top: 0;
  width: calc(var(--ray-cap-w) + var(--ray-cap-over));
  height: 100%;
  border-radius: 999px;
  background: var(--ray-bg);
  z-index: -1; /* уходит под луч — шов исчезает */
  box-shadow: -10px 0 22px rgba(15,23,42,.08);
  opacity: .98;
}

/* мягкий блик поверх */
.ted-sun-widget .tsw-ray::after{
  content:"";
  position:absolute;
  inset: 1px;
  border-radius: calc(var(--ray-radius) - 2px);
  background:
    radial-gradient(240px 90px at 14% 18%, rgba(255,255,255,.32), rgba(255,255,255,0) 62%),
    linear-gradient(90deg, rgba(255,255,255,.18), rgba(255,255,255,0));
  pointer-events:none;
  opacity: .58;
  z-index: 1;
}

.ted-sun-widget .tsw-ray:hover{
  transform: translateY(-1px);
  box-shadow: 0 18px 40px rgba(15,23,42,.14);
  filter: saturate(1.06);
}

/* Left side */
.ted-sun-widget .tsw-left{
  display:flex;
  align-items:center;
  gap:10px;
  min-width:0;
  position: relative;
  z-index: 2;
}
.ted-sun-widget .tsw-badge{
  width: 38px;
  height: 38px;
  border-radius: 14px;
  display:grid;
  place-items:center;
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.26);
  flex: 0 0 auto;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35);
}
.ted-sun-widget .tsw-title{
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Right side */
.ted-sun-widget .tsw-right{
  display:flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
  position: relative;
  z-index: 2;
  padding-right: 2px;
}
.ted-sun-widget .tsw-val{
  font-size: 32px;
  font-weight: 950;
  letter-spacing: -0.02em;
  line-height: 1;
  text-align: right;
  font-variant-numeric: tabular-nums;
  min-width: 44px;
}
.ted-sun-widget .tsw-unit{
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  opacity: .95;
}

/* Ray colors via variable */
.ted-sun-widget .tsw-train{ --ray-bg: linear-gradient(90deg, #7C3AED, #EC4899); }
.ted-sun-widget .tsw-level{ --ray-bg: linear-gradient(90deg, #2563EB, #06B6D4); }
.ted-sun-widget .tsw-lesson{ --ray-bg: linear-gradient(90deg, #F59E0B, #FACC15); }

/* Strong readable text (fix yellow + any overrides) */
.ted-sun-widget .tsw-ray .tsw-title,
.ted-sun-widget .tsw-ray .tsw-val,
.ted-sun-widget .tsw-ray .tsw-unit{
  color: rgba(255,255,255,.96) !important;
  text-shadow: 0 1px 2px rgba(0,0,0,.22) !important;
}
.ted-sun-widget .tsw-lesson .tsw-title,
.ted-sun-widget .tsw-lesson .tsw-val,
.ted-sun-widget .tsw-lesson .tsw-unit{
  text-shadow: 0 1px 3px rgba(0,0,0,.30) !important;
}

/* Summary */
.ted-sun-widget .tsw-summary{
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(15,23,42,.10);
}
.ted-sun-widget .tsw-summary h4{
  margin: 0 0 8px 0;
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(15,23,42,.55);
  font-weight: 950;
}
.ted-sun-widget .tsw-line{
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: rgba(15,23,42,.82);
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (max-width: 860px){
  .ted-sun-widget .tsw-grid{ grid-template-columns: 1fr; }
  .ted-sun-widget .tsw-orb{ margin: 0 auto; }
  .ted-sun-widget .tsw-line{ white-space: normal; }
}

/* Subtle motion */
@media (prefers-reduced-motion: no-preference){
  .ted-sun-widget .tsw-ray{ animation: tswFloat 7s ease-in-out infinite; }
  .ted-sun-widget .tsw-ray:nth-child(2){ animation-delay: .35s; }
  .ted-sun-widget .tsw-ray:nth-child(3){ animation-delay: .7s; }
  @keyframes tswFloat{ 0%,100%{ transform: translateY(0); } 50%{ transform: translateY(-1px); } }
}
